package chap09;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.Socket;

public class TCP_client {
    public static void main(String [] args) throws IOException {
        Socket client=new Socket("localhost",8888);//发送到 8888端口 没错啊
        BufferedReader in= new BufferedReader(new InputStreamReader(client.getInputStream()));
        //BufferedRead 还是要inputStreamReader套上 同一个父子可以赋值  接受流
        String str= null;//只接受一行数据
        while((str=in.readLine())!=null){
        System.out.println("来组serverSocket 数据:"+str);
        }
        client.close();
        in.close();


    }
}
